﻿<UserControl x:Class="Matchingo.Modules.StatusBarModule.Views.StatusBarView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:converters="clr-namespace:Matchingo.Common.Types.Converters;assembly=Matchingo.Common.Types"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    Width="360" 
    mc:Ignorable="d">
    
    <UserControl.Resources>        
        <converters:TimerDisplayConverter x:Key="TimerConverter"/>
        
        <SolidColorBrush x:Name="StatusBarTextColor" Color="White" />
        
        <Style x:Key="StatusTextStyle" TargetType="TextBlock">
            <Setter Property="Foreground" Value="{StaticResource StatusBarTextColor}" />
            <Setter Property="FontFamily" Value="Courier New" />
            <Setter Property="FontSize" Value="14" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Margin" Value="4,0,0,0" />
        </Style>
        
        <Style x:Key="StatusButtons" TargetType="Button">
            <Setter Property="Width" Value="20"/>
            <Setter Property="Height" Value="20"/>
            <Setter Property="Margin" Value="2"/>
        </Style>
        <Storyboard x:Name="TextPulse" AutoReverse="True" RepeatBehavior="Forever">
        	<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="PulsingTextBlock" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)">
        		<SplineColorKeyFrame KeyTime="00:00:00" Value="#3FFF0000"/>
        		<SplineColorKeyFrame KeyTime="00:00:01" Value="#FFFF0000"/>
        	</ColorAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Name="ComboPulse" AutoReverse="True" RepeatBehavior="Forever">
        	<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ComboTextBlock" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)">
        		<SplineColorKeyFrame KeyTime="00:00:00" Value="#3FFF0000"/>
        		<SplineColorKeyFrame KeyTime="00:00:01" Value="#FFFF0000"/>
        	</ColorAnimationUsingKeyFrames>
        </Storyboard>
    </UserControl.Resources>
    
    <Grid x:Name="LayoutRoot" IsHitTestVisible="False">
        <Grid.ColumnDefinitions>
           
            <!-- player score -->
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="60"/>            
            
            <!-- high score -->
            <ColumnDefinition Width="*"/>
            
        </Grid.ColumnDefinitions>
        
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        
        <!-- top row of data (time elapsed) -->
                          
        <!-- Text="{Binding PlayersName}" -->
        <Rectangle x:Name="BackgroundFill" Grid.ColumnSpan="3" Grid.Row="1" Fill="{StaticResource StatusBackgroundGradient}" Stroke="#FF000000" Grid.RowSpan="2"/>
    	<TextBlock 
    		Style="{StaticResource StatusTextStyle}" x:Name="UserName"                   
    		Text="{Binding Path=PlayersName}"
    		Grid.Row="1"
			TextAlignment="Center" FontFamily="Trebuchet MS" FontSize="10"/>
        
    	<TextBlock Grid.Column="0" Grid.Row="2" 
    		Style="{StaticResource StatusTextStyle}"
    		Text="{Binding Path=PlayerScore}" x:Name="UserScore" TextAlignment="Center" FontFamily="Trebuchet MS" FontSize="15"/>

    	<TextBlock Grid.Column="1" Style="{StaticResource StatusTextStyle}"
    		x:Name="TimerTextBlock"
    		Text="{Binding Converter={StaticResource TimerConverter}, Path=TimeElapsed}"
    		Margin="0,0,0,0" Grid.Row="1" Grid.RowSpan="2" FontSize="24" FontFamily="./../Fonts/Fonts.zip#Digital Readout" FontWeight="Normal" d:IsStaticText="True"/>

    	<TextBlock Grid.Column="2" 
    		Style="{StaticResource StatusTextStyle}" 
    		x:Name="HighScore" Grid.Row="1" 
    		Text="High Score" 
    		TextAlignment="Center" FontFamily="Trebuchet MS" FontSize="10"/>
        
    	<TextBlock Grid.Column="4" Grid.Row="2"
    		Style="{StaticResource StatusTextStyle}"
    		Text="{Binding Path=HighScore}"
    		x:Name="HighScoreScore" TextAlignment="Center" FontFamily="Trebuchet MS" FontSize="15"/>
    	<TextBlock Grid.Row="0" FontFamily="Portable User Interface" FontSize="36" FontWeight="Bold" Foreground="#00FF0000" Text="dyn" TextWrapping="Wrap" Padding="0,0,0,0" d:LayoutOverrides="Height" Grid.Column="0" x:Name="PulsingTextBlock" IsHitTestVisible="False" TextAlignment="Right" Grid.ColumnSpan="3" Margin="0,0,10,0"/>
    	<TextBlock FontFamily="Portable User Interface" FontSize="36" FontWeight="Bold" Foreground="#00FF0000" Text="dyn" TextWrapping="Wrap" Padding="0,0,0,0" x:Name="ComboTextBlock" IsHitTestVisible="False" TextAlignment="Left" Margin="10,0,10,0" Grid.Column="0" Grid.ColumnSpan="3" d:LayoutOverrides="Height"/>
    </Grid>
    
</UserControl>